package com.wngbms.multidatasource.learn;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class BeanFactoryAwareLearn implements BeanFactoryAware {
    // org.springframework.beans.factory.support.DefaultListableBeanFactory
    BeanFactory beanFactory;

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;

        EnvironmentAwareLearn bean = beanFactory.getBean(EnvironmentAwareLearn.class);
        log.info("====>bean:[{}]", bean);
    }
}
